<template>
  <div class="newer-guide">
    <app-icon @click="closeMe" iconName="vcloud-close" className="close-btn"></app-icon>
    <div class="guide" @click="openGuide(0)">
      <img class="guide-img" src="./步骤1.png" alt="step1" />
      <div class="guide-text">
        <span class="num num1">1</span>
        <span>{{ items[0] && items[0].title }}</span>
      </div>
    </div>
    <div class="guide" style="margin: 0 120px" @click="openGuide(1)">
      <img class="guide-img" src="./步骤2.png" alt="step2" />
      <div class="guide-text">
        <span class="num num2">2</span>
        <span>{{ items[1] && items[1].title }}</span>
      </div>
    </div>
    <div class="guide" @click="openGuide(2)">
      <img class="guide-img" src="./步骤3.png" alt="step3" />
      <div class="guide-text">
        <span class="num num3">3</span>
        <span>{{ items[2] && items[2].title }}</span>
      </div>
    </div>
  </div>
</template>

<script>
import { openWin } from "cloud-common/tool/tool";

export default {
  name: "newerGuide",

  data() {
    return {
      items: [],
    };
  },

  created() {
    setTimeout(()=>{
      this.api.getNoviceGuideInfo({}, { method: "get" }).then(({ data }) => {
        this.items = data;
      });
    },3000)

  },

  methods: {
    closeMe() {
      this.$parent.triggerNewerGuide();
    },

    openGuide(i) {
      openWin(this.items[i].url, this.items[i].title);
    },
  },
};
</script>

<style lang="scss" scoped>
.newer-guide {
  position: relative;
  display: flex;
  justify-content: center;
  /*justify-content: space-evenly; // IE不支持space-evenly*/
  align-items: center;
  flex: 0 0 0px; // IE的flex-basis需要单位
  background-color: #eff2f5;
  transition: flex 0.2s ease-in-out;
  overflow: hidden;

  &.active {
    flex: 0 0 250px;
    transition-duration: 0.4s;
  }
}

.close-btn {
  position: absolute;
  top: 30px;
  right: 30px;
  color: #666666;
  cursor: pointer;
}

.guide {
  text-align: center;
  cursor: pointer;
}

.guide-img {
  width: 106px;
}

.num {
  display: inline-block;
  width: 34px;
  margin-right: 12px;
  line-height: 32px;
  font-size: 22px;
  box-shadow: 0 20px 20px 0 rgba(0, 0, 0, 0.06);
  border: 1px solid rgba(51, 108, 251, 0.2);
  border-radius: 50%;

  &.num1 {
    color: #07cef6;
  }

  &.num2 {
    color: #ff84a8;
  }

  &.num3 {
    color: #12c4c4;
  }
}

.guide-text {
  font-size: 18px;
  font-weight: 600;
}
</style>